<?php

class ZFBootstrap_Boxes_Box {

	private $_boxId = 'box';
	private $_boxLabel;
	private $_itens = array();

	public function __construct($label, $id = null) {
		$this->_boxLabel = $label;

		if (null === $id) {
			$id = 'box_' . preg_replace('#[^a-z0-9]#i', '', $label);
		}
		$this->_boxId = $id;
	}

	public function addForm(Zend_Form $form) {
		$this->addItem($form->getId(), $form);
	}

	public function addGrid(Bvb_Grid $grid) {
		$this->addItem($grid->getNameGrid(), $grid);
	}

	protected function addItem($key, $value) {
		$this->_itens[$key] = $value;
	}

	public function addPart($partName, $partValues = array()) {
		$this->addItem($partName, array(
			'name' => $partName,
			'type' => 'part',
			'values' => $partValues,
		));
	}

	public function getBoxId() {
		return $this->_boxId;
	}

	public function getBoxLabel() {
		return $this->_boxLabel;
	}

	public function getItens() {
		return $this->_itens;
	}

}